<template>
  <view class="cross-border">
    <!-- 顶部banner -->
    <view class="banner">
      <swiper 
        class="banner-swiper" 
        :indicator-dots="true" 
        :autoplay="true" 
        interval="3000" 
        duration="1000"
        indicator-color="rgba(255,255,255,0.6)"
        indicator-active-color="#ffffff"
      >
        <swiper-item v-for="(item, index) in banners" :key="index">
          <image :src="item.image" mode="aspectFill" />
          <view class="overlay"></view>
          <view class="banner-content">
            <text class="title">{{ item.title }}</text>
            <text class="subtitle">{{ item.subtitle }}</text>
          </view>
        </swiper-item>
      </swiper>
    </view>
    
    <!-- 服务优势 -->
    <view class="section">
      <view class="section-title">
        <text class="main">服务优势</text>
        <text class="sub">Our Advantages</text>
      </view>
      <view class="advantage-grid">
        <view 
          class="advantage-item"
          v-for="(item, index) in advantages"
          :key="index"
        >
          <image :src="item.icon" mode="aspectFit" class="icon" />
          <text class="name">{{ item.name }}</text>
          <text class="desc">{{ item.desc }}</text>
        </view>
      </view>
    </view>
    
    <!-- 合作医院 -->
    <view class="section">
      <view class="section-title">
        <text class="main">合作医院</text>
        <text class="sub">Partner Hospitals</text>
      </view>
      <scroll-view 
        scroll-x 
        class="hospital-list"
        :show-scrollbar="false"
      >
        <view 
          class="hospital-item"
          v-for="(item, index) in hospitals"
          :key="index"
          @tap="viewHospital(item)"
        >
          <image :src="item.image" mode="aspectFill" class="hospital-image" />
          <view class="content">
            <text class="name">{{ item.name }}</text>
            <text class="location">{{ item.location }}</text>
            <view class="tags">
              <text v-for="(tag, idx) in item.tags" :key="idx">{{ tag }}</text>
            </view>
          </view>
        </view>
      </scroll-view>
    </view>
    
    <!-- 服务流程 -->
    <view class="section">
      <view class="section-title">
        <text class="main">服务流程</text>
        <text class="sub">Service Process</text>
      </view>
      <view class="process-list">
        <view 
          class="process-item"
          v-for="(item, index) in process"
          :key="index"
        >
          <view class="step">{{ index + 1 }}</view>
          <view class="info">
            <text class="name">{{ item.name }}</text>
            <text class="desc">{{ item.desc }}</text>
          </view>
        </view>
      </view>
    </view>
    
    <!-- 成功案例 -->
    <view class="section">
      <view class="section-title">
        <text class="main">成功案例</text>
        <text class="sub">Success Cases</text>
      </view>
      <view class="case-list">
        <view 
          class="case-item"
          v-for="(item, index) in cases"
          :key="index"
          @tap="viewCase(item)"
        >
          <image :src="item.image" mode="aspectFill" class="case-image" />
          <view class="content">
            <text class="title">{{ item.title }}</text>
            <text class="desc">{{ item.desc }}</text>
            <view class="meta">
              <text class="hospital">{{ item.hospital }}</text>
              <text class="date">{{ item.date }}</text>
            </view>
          </view>
        </view>
      </view>
    </view>
    
    <!-- 联系咨询 -->
    <view class="contact-card">
      <view class="info">
        <text class="title">专业顾问为您服务</text>
        <text class="desc">提供一站式跨境医疗咨询服务</text>
      </view>
      <button class="contact-btn" @tap="showConsult">立即咨询</button>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'

// banner数据
const banners = ref([
  {
    image: '/static/cross-border/banner1.jpg',
    title: '全球优质医疗资源',
    subtitle: '连接世界顶级医疗机构'
  },
  {
    image: '/static/cross-border/banner2.jpg',
    title: '专业医疗团队',
    subtitle: '提供全程医疗陪诊服务'
  }
])

// 服务优势
const advantages = ref([
  {
    icon: '/static/cross-border/icon1.png',
    name: '全球资源',
    desc: '对接国际顶级医疗机构'
  },
  {
    icon: '/static/cross-border/icon2.png',
    name: '专业团队',
    desc: '医疗专家一对一服务'
  },
  {
    icon: '/static/cross-border/icon3.png',
    name: '便捷服务',
    desc: '提供全程医疗陪诊'
  },
  {
    icon: '/static/cross-border/icon4.png',
    name: '无忧保障',
    desc: '专业翻译和保险服务'
  }
])

// 合作医院
const hospitals = ref([
  {
    id: 1,
    name: '香港养和医院',
    location: '香港跑马地',
    image: '/static/hospital/hk1.jpg',
    tags: ['肿瘤治疗', '心血管', '体检']
  },
  {
    id: 2,
    name: '新加坡伊丽莎白医院',
    location: '新加坡',
    image: '/static/hospital/sg1.jpg',
    tags: ['妇产科', '儿科', '体检']
  }
])

// 服务流程
const process = ref([
  {
    name: '在线咨询',
    desc: '专业顾问了解需求，提供初步建议'
  },
  {
    name: '方案定制',
    desc: '根据病情定制个性化医疗方案'
  },
  {
    name: '预约安排',
    desc: '协助预约医院、医生及相关检查'
  },
  {
    name: '陪诊服务',
    desc: '全程陪同就医、翻译及生活照顾'
  }
])

// 成功案例
const cases = ref([
  {
    id: 1,
    title: '赴港就医案例',
    desc: '协助内地患者赴港进行精准靶向治疗...',
    image: '/static/cross-border/case1.jpg',
    hospital: '香港养和医院',
    date: '2024-03-15'
  },
  {
    id: 2,
    title: '新加坡就医案例',
    desc: '为患者安排赴新加坡进行高端体检...',
    image: '/static/cross-border/case2.jpg',
    hospital: '新加坡伊丽莎白医院',
    date: '2024-03-10'
  }
])

// 查看医院详情
const viewHospital = (hospital) => {
  uni.navigateTo({
    url: `/pages/hospital/detail?id=${hospital.id}`
  })
}

// 查看案例详情
const viewCase = (case_) => {
  uni.navigateTo({
    url: `/pages/featured/case?id=${case_.id}`
  })
}

// 显示咨询
const showConsult = () => {
  uni.showModal({
    title: '联系我们',
    content: '专业顾问将为您提供一对一咨询服务',
    confirmText: '立即咨询',
    success: (res) => {
      if (res.confirm) {
        uni.makePhoneCall({
          phoneNumber: '+853 2837 1333'
        })
      }
    }
  })
}
</script>

<style lang="scss">
.cross-border {
  min-height: 100vh;
  background: $bg-color;
  
  .banner {
    height: 500rpx;
    
    .banner-swiper {
      height: 100%;
      
      swiper-item {
        position: relative;
        
        image {
          width: 100%;
          height: 100%;
        }
        
        .overlay {
          position: absolute;
          left: 0;
          right: 0;
          top: 0;
          bottom: 0;
          background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.6));
        }
        
        .banner-content {
          position: absolute;
          left: 40rpx;
          bottom: 40rpx;
          color: #fff;
          
          .title {
            font-size: 48rpx;
            font-weight: bold;
            margin-bottom: 12rpx;
            display: block;
            text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.2);
          }
          
          .subtitle {
            font-size: 28rpx;
            opacity: 0.9;
            display: block;
            text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.2);
          }
        }
      }
    }
  }
  
  .section {
    background: #fff;
    margin: 20rpx 30rpx;
    padding: 30rpx;
    border-radius: $radius-lg;
    
    .section-title {
      text-align: center;
      margin-bottom: 30rpx;
      
      .main {
        font-size: 36rpx;
        color: $text-primary;
        font-weight: bold;
        margin-bottom: 8rpx;
        display: block;
      }
      
      .sub {
        font-size: 24rpx;
        color: $text-secondary;
        text-transform: uppercase;
        letter-spacing: 2rpx;
      }
    }
  }
  
  .advantage-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30rpx;
    
    .advantage-item {
      background: $bg-color;
      border-radius: $radius-lg;
      padding: 30rpx;
      text-align: center;
      
      .icon {
        width: 80rpx;
        height: 80rpx;
        margin-bottom: 16rpx;
      }
      
      .name {
        font-size: 30rpx;
        color: $text-primary;
        font-weight: bold;
        margin-bottom: 8rpx;
        display: block;
      }
      
      .desc {
        font-size: 26rpx;
        color: $text-regular;
      }
    }
  }
  
  .hospital-list {
    white-space: nowrap;
    
    .hospital-item {
      display: inline-block;
      width: 500rpx;
      margin-right: 20rpx;
      background: $bg-color;
      border-radius: $radius-lg;
      overflow: hidden;
      
      &:last-child {
        margin-right: 0;
      }
      
      .hospital-image {
        width: 100%;
        height: 300rpx;
      }
      
      .content {
        padding: 20rpx;
        
        .name {
          font-size: 32rpx;
          color: $text-primary;
          font-weight: bold;
          margin-bottom: 8rpx;
          display: block;
        }
        
        .location {
          font-size: 26rpx;
          color: $text-regular;
          margin-bottom: 12rpx;
          display: block;
        }
        
        .tags {
          text {
            display: inline-block;
            font-size: 24rpx;
            color: $primary-color;
            background: $primary-light;
            padding: 4rpx 16rpx;
            border-radius: $radius-sm;
            margin-right: 12rpx;
          }
        }
      }
      
      &:active {
        transform: scale(0.98);
      }
    }
  }
  
  .process-list {
    .process-item {
      display: flex;
      align-items: flex-start;
      margin-bottom: 30rpx;
      
      &:last-child {
        margin-bottom: 0;
      }
      
      .step {
        width: 60rpx;
        height: 60rpx;
        background: $primary-gradient;
        color: #fff;
        font-size: 32rpx;
        font-weight: bold;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 20rpx;
        flex-shrink: 0;
      }
      
      .info {
        flex: 1;
        
        .name {
          font-size: 30rpx;
          color: $text-primary;
          font-weight: bold;
          margin-bottom: 8rpx;
          display: block;
        }
        
        .desc {
          font-size: 26rpx;
          color: $text-regular;
        }
      }
    }
  }
  
  .case-list {
    .case-item {
      background: $bg-color;
      border-radius: $radius-lg;
      margin-bottom: 20rpx;
      overflow: hidden;
      
      &:last-child {
        margin-bottom: 0;
      }
      
      .case-image {
        width: 100%;
        height: 300rpx;
      }
      
      .content {
        padding: 20rpx;
        
        .title {
          font-size: 32rpx;
          color: $text-primary;
          font-weight: bold;
          margin-bottom: 12rpx;
          display: block;
        }
        
        .desc {
          font-size: 28rpx;
          color: $text-regular;
          margin-bottom: 16rpx;
          display: block;
        }
        
        .meta {
          display: flex;
          justify-content: space-between;
          font-size: 24rpx;
          color: $text-secondary;
        }
      }
      
      &:active {
        transform: scale(0.99);
      }
    }
  }
  
  .contact-card {
    position: fixed;
    left: 30rpx;
    right: 30rpx;
    bottom: 40rpx;
    background: #fff;
    border-radius: $radius-lg;
    padding: 30rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: $shadow-lg;
    
    .info {
      .title {
        font-size: 32rpx;
        color: $text-primary;
        font-weight: bold;
        margin-bottom: 8rpx;
        display: block;
      }
      
      .desc {
        font-size: 26rpx;
        color: $text-regular;
      }
    }
    
    .contact-btn {
      width: 200rpx;
      height: 80rpx;
      line-height: 80rpx;
      font-size: 28rpx;
      color: #fff;
      background: $primary-gradient;
      border-radius: $radius-xl;
      
      &:active {
        transform: scale(0.98);
      }
    }
  }
}
</style> 